<?php
/************************FoxPHP威客系统************************/
/*                                                            */
/*  FoxPHP.Com (C)2006-2016 FoxPHP Inc.                       */
/*  This is NOT a freeware, use is subject to license terms   */
/*  FoxPHP威客系统是商业软件,使用于商业用途请购买授权         */
/*  V3.0 2016.3                                               */
/*  foxphp@aliyun.com                                         */
/*  http://www.foxphp.com                                     */
/*                                                            */
/**************************************************************/

//店铺
namespace Shop\Controller;
use Think\Controller;
class IndexController extends Controller{
	
	public function GetShop($shopuid=0){
		if(!$shopuid){
			$shopuid=intval($_GET['uid']);
		}
		
		$model=new \Member\Model\MemberModel();
		$member=$model->UidGetMember($shopuid);
		if(!$member['isshop']){
			$this->error('对不起，店铺不存在或已关闭！','/',3);
			exit();
		}

		$this->assign('shopuid',$shopuid);

		$this->assign('member',$member);
		
		//幻灯片
		$slidearray=M('ShopSlide')->token(false)->where(" uid=$shopuid ")->order('dateline ASC')->limit(3)->select();
		
		$this->assign('slidearray',$slidearray);
		
		//推荐服务
		$fuwutop=M('Data')->token(false)->where(" type=2 AND uid=$shopuid AND mytop=1 ")->order('dateline ASC')->limit(12)->select();
		$this->assign('fuwutop',$fuwutop);
		
		$this->assign('PATH',array('店铺',$member['shopname']));
		$this->assign('SEO',array('title'=>$member['shopname'],'keywords'=>$member['shopname'],'description'=>$member['shopname']));
		
		return $shopuid;
	}
	
	public function indexAction(){

		$shopuid=$this->GetShop();
		//最新服务
		$fuwunew=M('Data')->token(false)->where(" type=2 AND uid=$shopuid ")->order('dateline DESC')->limit(16)->select();
		$this->assign('fuwunew',$fuwunew);
				
		$this->display();
	}
	
}